package com.bruce.tool.push.jpush.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author Bruce(刘正航)
 */
@NoArgsConstructor(staticName = "create")
public class JpushNotification {

    @Getter
    private Android android;
    @Getter
    private Ios ios;
    @Getter
    private Voip voip;

    public JpushNotification android(Android android){
        this.android = android;
        return this;
    }

    public JpushNotification ios(Ios ios){
        this.ios = ios;
        return this;
    }

    public JpushNotification voip(Voip voip){
        this.voip = voip;
        return this;
    }

    @NoArgsConstructor(staticName = "create")
    public static class Android {
        @Getter
        private String alert;
        @Getter
        private String title;
        @Getter
        @JsonProperty("builder_id")
        private Integer builderId;
        @Getter
        @JsonProperty("large_icon")
        private String largeIcon;
        @Getter
        private Intent intent;
        @Getter
        private Extras extras;

        public Android alert(String alert){
            this.alert = alert;
            return this;
        }

        public Android title(String title){
            this.title = title;
            return this;
        }

        public Android builderId(Integer builderId){
            this.builderId = builderId;
            return this;
        }

        public Android largeIcon(String largeIcon){
            this.largeIcon = largeIcon;
            return this;
        }

        public Android alert(Intent intent){
            this.intent = intent;
            return this;
        }

        public Android alert(Extras extras){
            this.extras = extras;
            return this;
        }

        @NoArgsConstructor(staticName = "create")
        public static class Intent {
            @Getter
            private String url;
            public Intent url(String url){
                this.url = url;
                return this;
            }
        }

        @NoArgsConstructor(staticName = "create")
        public static class Extras {
            @Getter
            private Integer newsid;
            public Extras newsid(Integer newsid){
                this.newsid = newsid;
                return this;
            }
        }
    }

    @NoArgsConstructor(staticName = "create")
    public static class Ios {
        @Getter
        private String alert;
        @Getter
        private String sound;
        @Getter
        private String badge;
        @Getter
        @JsonProperty("thread-id")
        private String threadid;
        @Getter
        private Extras extras;

        public Ios alert(String alert){
            this.alert = alert;
            return this;
        }

        public Ios sound(String sound){
            this.sound = sound;
            return this;
        }

        public Ios badge(String badge){
            this.badge = badge;
            return this;
        }

        public Ios threadid(String threadid){
            this.threadid = threadid;
            return this;
        }

        public Ios extras(Extras extras){
            this.extras = extras;
            return this;
        }

        @NoArgsConstructor(staticName = "create")
        public static class Extras {
            @Getter
            private Integer newsid;
            public Extras newsid(Integer newsid){
                this.newsid = newsid;
                return this;
            }
        }
    }

    @NoArgsConstructor(staticName = "create")
    public static class Voip {
        @Getter
        private String key;
        public Voip key(String key){
            this.key = key;
            return this;
        }
    }
}
